<!DOCTYPE html>
<html lang="en">
<#header/>
<body>
    <div class="layui-fluid layui-tab-brief">
        <form id="orgFuncForm" action="/dept/doOrgFunc.btl" class="layui-form">
            <input type="hidden" name="orgId" value="${orgId}">
        <div class="layui-tab layui-tab-card">
            <ul class="layui-tab-title">
                @for(menu in menus){
                @if(menuLP.first){
                <li class="layui-this">${menu.menuText}</li>
                @}else{
                <li>${menu.menuText}</li>
                @}
                @}
            </ul>
            <div class="layui-tab-content">
                @for(menu in menus){
                @if(menuLP.first){
                <div class="layui-tab-item layui-show" style="padding:5px 5px 5px 5px;">
                    @if(menu.menuName=='checked'){
                    <input type="checkbox" name="funcIds" value="${menu.menuFunc}" title="${menu.menuText}" checked>
                    @}else{
                    <input type="checkbox" name="funcIds" value="${menu.menuFunc}" title="${menu.menuText}">
                    @}
                    @for(submenu in menu.subMenu){
                    @if(submenu.menuName=='checked'){
                    <input type="checkbox" name="funcIds" value="${submenu.menuFunc}" title="${submenu.menuText}" checked>
                    @}else{
                    <input type="checkbox" name="funcIds" value="${submenu.menuFunc}" title="${submenu.menuText}">
                    @}
                    @}
                </div>
                @}else{
                <div class="layui-tab-item" style="padding:5px 5px 5px 5px;">
                    @if(menu.menuName=='checked'){
                    <input type="checkbox" name="funcIds" value="${menu.menuFunc}" title="${menu.menuText}" checked>
                    @}else{
                    <input type="checkbox" name="funcIds" value="${menu.menuFunc}" title="${menu.menuText}">
                    @}
                    @for(submenu in menu.subMenu){
                    @if(submenu.menuName=='checked'){
                    <input type="checkbox" name="funcIds" value="${submenu.menuFunc}" title="${submenu.menuText}" checked>
                    @}else{
                    <input type="checkbox" name="funcIds" value="${submenu.menuFunc}" title="${submenu.menuText}">
                    @}
                    @}
                </div>
                @}
                @}
            </div>
        </div>
            <button class="layui-btn" lay-submit lay-filter="orgFuncForm">立即提交</button>
        </form>
    </div>
    <script>
        layui.use(["element","form","jquery","layer"],function(){
           var element = layui.element;
           var form = layui.form;
           var $ = layui.$;
           var layer = layui.layer;
            form.on('submit(orgFuncForm)',function(data){
                $.post($("#orgFuncForm").attr("action"),$("#orgFuncForm").serialize(),function(data){
                    if(data=="success"){
                        layer.msg('保存成功', {
                            time: 0 //不自动关闭
                            ,btn: ['关闭本窗口', '取消']
                            ,yes: function(index){
                                layer.close(index);
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                                window.top.location.reload();
                            }
                        });
                    }else if(data=="failed"){
                        lay.msg('保存失败');
                    }
                });
                return false;
            });
        });
    </script>
</body>
</html>